﻿using System;
using System.Collections.Generic;
using System.Text;
using OpenWings.Entities;
using System.Drawing;

namespace OpenWings.UI.Elements
{
    public class TreeNodeGroup : TreeNode<Group>
    {
        public TreeNodeGroup(Group group)
            : base(group)
        {
            PopulateNode();

            this.InnerEntity.DirtyChanged += new EventHandler<DirtyChangedEventArgs>(InnerEntity_DirtyChanged);
        }
        
        void InnerEntity_DirtyChanged(object sender, DirtyChangedEventArgs e)
        {
            PopulateNode();
        }

        void PopulateNode()
        {
            this.Text = InnerEntity.Name;

            if (InnerEntity.IsDirty)
                this.NodeFont = new Font(new FontFamily("Trebuchet MS"),  10, FontStyle.Bold);
            else
                this.NodeFont = new Font(new FontFamily("Trebuchet MS"), 10, FontStyle.Regular);
        }
    }
}
